/*
 *  Car Manager
 *  Copyright 2002-2005 Tommi Laukkanen
 *  http://www.substanceofcode.com
 *
 *  ExportForm.java (Not used yet :) )
 *
 *  Created on December 28th 2004, 22:14
 */
package com.substanceofcode.carmanager.view;

import com.substanceofcode.carmanager.controller.CarManagerMIDlet;
import javax.microedition.lcdui.*;

/**
 *
 * @author  Tommi Laukkanen
 */
public class ExportForm extends Form implements CommandListener {
    private CarManagerMIDlet m_midlet;
    private Command cmdSend   = new Command("Send",   Command.SCREEN, 1);
    private Command cmdCancel = new Command("Cancel", Command.SCREEN, 2);
    
    /** Creates a new instance of ExportForm */
    public ExportForm(CarManagerMIDlet midlet) 
    {
        super(null);
        m_midlet = midlet;
        setCommandListener(this);
        
        TextField txtEmailAddr = new TextField("", "Email address", 
                                           TextField.EMAILADDR, 64);
        this.append(txtEmailAddr);
    }
    
    /** Handles the Send and Cancel commands.
     *  Send command sends the list to server and server's PHP script
     *  generates the email and sends it to recipient.
     */
    public void commandAction(Command c, Displayable d)
    {
        if(c==cmdSend)
        {
            m_midlet.showMainCanvas();
        }
        else if(c==cmdCancel)
        {
            m_midlet.showMainCanvas();
        }
    }

    
}
